The following functions can be implemented by packet reassembler components. As noted, some of these functions must be implemented in your component, some can be delegated to the base component, and some are base component utility functions that your component can call.
The base reassembler will call this function when it is ready to have your packet reassembler begin handling media packets (this function is not called when the base reassembler opens your component to check its version).
ComponentResult RTPRssmInitialize (
RTPReassembler rtpr,
RTPRssmInitParams *inInitParams);
This function is called to reset all packet reassembler and base reassembler variables for a new run of data.
ComponentResult RTPRssmReset (
RTPReassembler rtpr,
SInt32 inFlags);
The base reassembler will call this function to give your packet reassembler the opportunity to compute the size of a chunk, based on the packet list for the chunk, using your own algorithm. This function is called once for each packet list. Implement this function only if you need to override the base reassembler's default computation.
ComponentResult RTPRssmComputeChunkSize (
RTPReassembler rtpr,
RTPRssmPacket *inPacketListHead,
SInt32 inFlags,
UInt32 *outChunkDataSize);
This function is called by the base reassembler when it is processing a packet. This allows your packet reassembler to adjust the packet parameters before the packet is processed.
ComponentResult RTPRssmAdjustPacketParams (
RTPReassembler rtpr,
RTPRssmPacket *inPacket,
SInt32 inFlags);
If your packet reassembler does not implement this function, or takes no action, the default for these parameters will be: payloadHeaderLength = fixed header length that is set (default is 0) dataLength = packetData - transportHeaderLength - payloadHeaderLength no serverEditParams chunkFlags = 0
The base reassembler will call this function to allow your packet reassembler the opportunity to write the chunk data, based on the list of packets for the chunk, using your own algorithm. For example, an H.261 packet reassembler must adjust the byte at packet boundaries. Implement this function only if you need to override the base reassembler's default behavior.
ComponentResult RTPRssmCopyDataToChunk (
RTPReassembler rtpr,
RTPRssmPacket *inPacketListHead,
UInt32 inMaxChunkDataSize,
SHChunkRecord *inChunk,
SInt32 inFlags);
The base reassembler will call this function when it is ready to create a chunk and send it to the stream handler, based on a list of packets. Implement this call if your packet reassembler needs to modify the packet list, or if it overrides the default handling of packet loss.
ComponentResult RTPRssmSendPacketList (
RTPReassembler rtpr,
RTPRssmPacket *inPacketListHead,
const TimeValue64 *inLastChunkPresentationTime,
SInt32 inFlags);
If you do not implement this call, the base reassembler will adjust the packet parameters on all packets in the list, compute the chunk size, and send the chunk. If packet loss has occured, all the packets will be discarded and the stream handler will be informed that the chunk has been lost. If you implement this function inFlags will be set to indicate packet loss if you have instructed to base reassembler to do so in RTPRssmSetCapabilities .
If your packet reassembler has not specified a timescale as part of RTPRssmNewStreamHandler , or by calling RTPRssmSetTimeScale , the base reassembler will call this function when it receives packets. This allows your packet reassembler to extract the timescale from a received packet and return it to the base reassembler. The base reassembler will discard received packets until it has been given a valid timescale.
ComponentResult RTPRssmGetTimeScaleFromPacket (
RTPReassembler rtpr,
QTSStreamBuffer *inStreamBuffer,
TimeScale *outTimeScale);
Your packet reassembler must set a time scale for the stream handler before the base reassembler can process any incoming packets. If your packet reassembler doesn't know the timescale of its media in advance, because the timescale is contained in the packets for example, the base reassembler will prompt you for a timescale whenever it receives a packet. If your packet reassembler always uses the same timescale, it should set the timescale when it opens a stream handler, and it does not need to implement this function.
This function is called to set various parameters of your packet reassembler. It is also called to set parameters of the base reassembler.
ComponentResult RTPRssmSetInfo (
RTPReassembler rtpr,
OSType inSelector,
void *ioParams);
The QTS Toolbox calls this function to obtain information about your packet reassembler.
ComponentResult RTPRssmGetInfo (
RTPReassembler rtpr,
OSType inSelector,
void *ioParams);
Your reassembler calls this function, typically as part of RPTRssmInitialize , to set flags that control the base reassembler.
ComponentResult RTPRssmSetCapabilities (
RTPReassembler rtpr,
SInt32 inFlags,
SInt32 inFlagsMask);
Your packet reassembler can call this function to obtain the current flag settings for the base reassembler.
ComponentResult RTPRssmGetCapabilities (
RTPReassembler rtpr,
SInt32 *outFlags);
Your packet reassembler calls this function to set a fixed payload header length. If this is not set, the default value is zero.
ComponentResult RTPRssmSetPayloadHeaderLength (
RTPReassembler rtpr,
UInt32 inPayloadHeaderLength);
Your packet reassembler can call this function to obtain the current value of the fixed payload header length from the base reassembler.
ComponentResult RTPRssmGetPayloadHeaderLength (
RTPReassembler rtpr,
UInt32 *outPayloadHeaderLength);
Your packet reassembler uses this function to set the timescale for the stream handler that will render your output. The timescale is the number of time units that pass in one second for the media whose sample data is carried in this stream. The stream handler's timescale must be set before it can deliver any data to the user.
ComponentResult RTPRssmSetTimeScale (
RTPReassembler rtpr,
TimeScale inSHTimeScale);
Your packet reassembler can call this function to obtain the current timescale from the base reassembler.
ComponentResult RTPRssmGetTimeScale (
RTPReassembler rtpr,
TimeScale *outSHTimeScale);
This function causes the base reassembler to open a new stream handler. Any currently-opened stream handler will be closed.
ComponentResult RTPRssmNewStreamHandler (
RTPReassembler rtpr,
OSType inSHType,
SampleDescriptionHandle inSampleDescription,
TimeScale inSHTimeScale,
ComponentInstance *outHandler);
Your packet reassembler should call this function when it is initialized.
You must pass in a valid sample description and time scale before the stream handler can process packets. If you do not pass them as part of this function, do so using RTPRssmSetTimeScale and RTPRssmSetSampleDescription .
Your packet reassembler should call this function when something has changed in the stream and you want the notification propagated (for example, you have changed the dimensions of the video).
ComponentResult RTPRssmSendStreamHandlerChanged (RTPReassembler rtpr);
Your packet reassembler uses this function to change the sample description being used by the stream handler. All subsequent samples will be marked with this new sample description.
ComponentResult RTPRssmSetSampleDescription (
RTPReassembler rtpr,
SampleDescriptionHandle inSampleDescription);
Your packet reassembler uses this function to cause the base reassembler to create a chunk for you manually.
ComponentResult RTPRssmGetChunkAndIncrRefCount (
RTPReassembler rtpr,
UInt32 inChunkDataSize,
const TimeValue64 *inChunkPresentationTime,
SHChunkRecord **outChunk);
Your packet reassembler can call this function when it has finished constructing a chunk and wants the base reassembler to send it to the stream handler.
ComponentResult RTPRssmSendChunkAndDecrRefCount (
RTPReassembler rtpr,
SHChunkRecord *inChunk,
const SHServerEditParameters *inServerEdit);
Your packet reassembler can use this function to cause the base reassembler to send loss notification to the stream handler.
ComponentResult RTPRssmSendLostChunk (
RTPReassembler rtpr,
const TimeValue64 *inChunkPresentationTime);
Your packet reassembler uses this function to cause the base reassembler to flush all packets currently queued in its lists.
ComponentResult RTPRssmFlushPackets (RTPReassembler rtpr);
Use this function to release the memory associated with a packet list that your packet reassembler created itself, or a list your reassembler took ownership of as a result of implementing RTPRssmSendPacketlist .
ComponentResult RTPRssmReleasePacketList (
RTPReassembler rtpr,
RTPRssmPacket *inPacketListHead);
Use this function to tell the base reassembler to keep a copy of a chunk, to assist in loss recovery, for example.
ComponentResult RTPRssmIncrChunkRefCount (
RTPReassembler rtpr,
SHChunkRecord *inChunk);
Tell the base reassembler to devrement the reference counter of a chunk that it has created or preserved for you. If the reference count becomes zero, the chunk is deallocated.
ComponentResult RTPRssmDecrChunkRefCount (
RTPReassembler rtpr,
SHChunkRecord *inChunk);
If you have overriden the RTPRssmSendPacketList behavior, and are instructing the base reassembler to construct chunks manually, your packet assembler must explictly dispose of the chunks by calling either RTPRssmDecrChunkRefCount or RTPRssmSendChunkAndDecrRefCount . This function is also used to release a chunk you have preserved using the RTPRssmIncrChunkRefCount function.
| Previous | Chapter Contents | Chapter Top | Next |